package com.oo.abstractAndInterface_6.atm;

/**
 * LocalCard--本地银行卡
 *
 * @author: Jovi
 * @createTime: 2017-03-24 16:57
 **/
public class LocalCard extends Card{

    public LocalCard(String id, String passwd, String name, double balance) {
        super(id, passwd, name, balance);
    }

    @Override
    public boolean withdrawingMoney(double money) {
        if (this.getBalance() >= money) {
            this.setBalance(this.getBalance() - money);
            return true;
        } else {
            return false;
        }
    }

    public boolean postMoney(Card card, double money) {

        if (this.getBalance() >= money) {
            this.setBalance(this.getBalance() - money);
            card.setBalance(card.getBalance() + money);
            return true;
        } else {
            return false;
        }
    }


}
